﻿
namespace Bookworm.Core
{
    public partial class EbookTocXml
    {
        public static explicit operator EbookTocCollection(EbookTocXml ebookContentsXml)
        {
            var ebookContentCollection = new EbookTocCollection();
            ebookContentCollection.CopyFromArray(ebookContentsXml.item, ebookContent => (EbookToc)ebookContent);
            return ebookContentCollection;
        }

        public static explicit operator EbookTocXml(EbookTocCollection ebookContentCollection)
        {
            var ebookContentsXml = new EbookTocXml();
            ebookContentsXml.item = ebookContentCollection.ToArray(ebookcontent => (ebooktocItem)ebookcontent);
            return ebookContentsXml;

        }
    }

    public partial class ebooktocItem
    {
        public static explicit operator EbookToc(ebooktocItem ebooktocItem)
        {
            var eBookContent = new EbookToc();
            eBookContent.Title = ebooktocItem.Value;
            eBookContent.Target = ebooktocItem.target;
            eBookContent.PageNumber = ebooktocItem.pagenumber;
            return eBookContent;
        }

        public static explicit operator ebooktocItem(EbookToc ebookContent)
        {
            var ebooktocitem = new ebooktocItem();
            ebooktocitem.Value = ebookContent.Title;
            ebooktocitem.target = ebookContent.Target;
            ebooktocitem.pagenumber = ebookContent.PageNumber;
            return ebooktocitem;
        }
    }

}


